package com.huatech.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.huatech.common.Result;
import com.huatech.domain.UserDetail;
import com.huatech.service.UserInfoService;

/**
 * @author lihua_java@163.com
 */
@RestController
public class UserController {

	@Autowired UserInfoService  userInfoService;
	
    @GetMapping("/api/index")
    public Object index(Authentication authentication){
    	UserDetail user = userInfoService.findByUserName(authentication.getName());
    	return Result.ok(user);
    }
}
